package com.ponhu.ea2.dto;

import com.ponhu.ea2.annotations.EnableColumnChangeLog;
import com.ponhu.ea2.support.validation.annotions.ValidateExpression;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 云商商品编辑对象
 * @author Wang
 * @date 2022/1/6 11:48 上午
 */
@Data
@Accessors(chain = true)
@ApiModel("云商商品编辑对象")
@ValidateExpression(expression = "inPrice <= supplyPrice and supplyPrice <= advicePrice", message = "价格必须符合：入库价<=供货价格<=建议售价")
public class CloudTradeGoodsEditDto extends OperatorDto implements Serializable {

    private static final long serialVersionUID = 3170947575072860184L;
    @ApiModelProperty("云商商品ID")
    private  Long id;

    @Min(value = 0, message = "入库价格不能小于0")
    @NotNull(message = "入库价格不能为空")
    @ApiModelProperty("入库价格")
    @EnableColumnChangeLog(columnDesc = "入库价格")
    private BigDecimal inPrice;

    @Min(value = 0, message = "建议售价不能小于0")
    @NotNull(message = "建议售价不能为空")
    @ApiModelProperty("建议售价")
    @EnableColumnChangeLog(columnDesc = "建议售价")
    private BigDecimal advicePrice;

    @Min(value = 0, message = "供货价不能小于0")
    @NotNull(message = "供货价不能为空")
    @ApiModelProperty("供货价")
    @EnableColumnChangeLog(columnDesc = "供货价")
    private BigDecimal supplyPrice;
}
